<template>
  <div class="B">
    B
    <br>

  </div>
</template>

<script setup lang="ts">
import { getCurrentInstance } from 'vue'
const instance = getCurrentInstance()

const Bus = (str: any) => {
  console.log('b=====>str', str)
}
instance?.proxy?.$Bus.on('on-EmitA', Bus)//监听一个

//同样的也有off方法
instance?.proxy?.$Bus.off('on-EmitA', Bus)

instance?.proxy?.$Bus.all.clear()//清楚全部事件


// instance?.proxy?.$Bus.on('*', (type, str) => {
//   console.log(type, 'b=====>str', str)
// })//监听多个
</script>

<style lang="scss" scoped>
@import '../style.scss';

.B {
  width: 200px;
  height: 200px;
  background-color: $cloud-water;
}
</style>